from django.db import models
from django.contrib.auth.models import AbstractUser
from django.conf import settings
from itsdangerous import TimedSerializer as Serializer



class User(AbstractUser):

    def generate_active_token(self):
        serializer = Serializer(settings.SECRET_KEY,3600)
        info = {'confirm':self.id}
        token = serializer.dumps(info)
        return token.decode()

    class Meta:
        db_table = 'df-user'
        verbose_name = '用户'
        verbose_name_plural = verbose_name

